﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace MT.ControlLibrary.Controls
{
    public class CustomSlider:Slider
    {
        //定义拇指按钮背景色
        public SolidColorBrush ThumbBackground
        {
            get { return (SolidColorBrush)GetValue(ThumbBackgroundProperty); }
            set { SetValue(ThumbBackgroundProperty, value); }
        }

        public static readonly DependencyProperty ThumbBackgroundProperty = DependencyProperty.Register("ThumbBackground", typeof(SolidColorBrush), typeof(CustomSlider), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00FE11"))));

        /// <summary>
        /// 拇指按钮的高度
        /// </summary>
        public double ThumbBtnHeight
        {
            get { return (double)GetValue(ThumbBtnHeightProperty); }
            set { SetValue(ThumbBtnHeightProperty, value); }
        }

        public static readonly DependencyProperty ThumbBtnHeightProperty = DependencyProperty.Register("ThumbBtnHeight", typeof(double), typeof(CustomSlider), new PropertyMetadata(15.0));

        /// <summary>
        /// 拇指按钮的高度
        /// </summary>
        public double ThumbBtnWidth
        {
            get { return (double)GetValue(ThumbBtnWidthProperty); }
            set { SetValue(ThumbBtnWidthProperty, value); }
        }

        public static readonly DependencyProperty ThumbBtnWidthProperty = DependencyProperty.Register("ThumbBtnWidth", typeof(double), typeof(CustomSlider), new PropertyMetadata(40.0));

        //滑动条划过背景色
        public SolidColorBrush ConverBackground
        {
            get { return (SolidColorBrush)GetValue(ConverBackgroundProperty); }
            set { SetValue(ConverBackgroundProperty, value); }
        }

        public static readonly DependencyProperty ConverBackgroundProperty = DependencyProperty.Register("ConverBackground", typeof(SolidColorBrush), typeof(CustomSlider), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#DBFFDE"))));

        /// <summary>
        /// 滑条的高度
        /// </summary>
        public double ConverThickness
        {
            get { return (double)GetValue(ConverThicknessProperty); }
            set { SetValue(ConverThicknessProperty, value); }
        }

        public static readonly DependencyProperty ConverThicknessProperty = DependencyProperty.Register("ConverThickness", typeof(double), typeof(CustomSlider), new PropertyMetadata(10.0));


        static CustomSlider()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomSlider), new FrameworkPropertyMetadata(typeof(CustomSlider)));
        }
    }
}
